package com.cby.leetcode.二分查找.LC162;

/**
 * 寻找存在的其中一个峰值，红蓝染色法
 */


public class LC162 {
    public static void main(String[] args){}
}


class Solution{
    public int findPeakElement(int[] nums) {
        int left = 0;
        int right = nums.length - 2;

        while(left <= right){
            int mid = (left + right) >>> 1;
            if(nums[mid + 1] >= nums[mid])
                left = mid + 1;
            else
                right = mid -1;
        }

        return left;

    }
}